//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<logic_manager.cpp>
///	@path	~/src/engine/xcore/
///	@date	2008/04/04
///	@desc	.

#include "config/config.h"

#include "lib/utilities/observer.h"
#include "lib/system/thread_debug.h"

#include "engine/xcore/logic_manager.h"

namespace xeres {

	// LogicManager
	LogicManager::LogicManager( void )
	{

	}
	// ~LogicManager
	LogicManager::~LogicManager( void )
	{

	}
	// Initialize
	void LogicManager::Initialize( ResourceLoader * loader , RefWeak<IData> scene_config )
	{
		SceneManager::Initialize( loader , scene_config );
		EntityManager::Initialize();
	}
	// Finalize
	void LogicManager::Finalize( void )
	{
		SceneManager::Finalize();
		EntityManager::Finalize();
	}
	// PreLoadScene
	TaskReturn LogicManager::PreLoadScene( const WString& name )
	{
		if( SceneManager::PreLoadScene( name ) )
			return TASK_SUCCESS;
		else
			return TASK_FAILED;
	}
	// Tick
	void LogicManager::Tick( const Frame& frame )
	{
		TRACK_FUNCTION_SCOPE();
		RUNNING_ON_THREAD( _S("tick") );

		COUNTER_GUARD( _S("logic") );
	}

} // namespace xeres
